package org.abc.fund.entity.trade;

import jakarta.persistence.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

@Entity
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class Account {
  @Id
  private Long userId;

  private BigDecimal balance;

  private String riskLevel;

  @ElementCollection(fetch = FetchType.EAGER) // Eager fetch for easier holding management
  @CollectionTable(name = "account_holding", joinColumns = @JoinColumn(name = "account_id"))
  @Builder.Default
  private List<Holding> holdings = new ArrayList<>();
}
